# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=lastversion
pkgver=3.4.6
pkgrel=0
pkgdesc="CLI tool to find the latest stable version of a project"
url="https://lastversion.getpagespeed.com/"
arch="noarch"
license="BSD-2-Clause"
depends="
	py3-appdirs
	py3-beautifulsoup4
	py3-cachecontrol
	py3-dateutil
	py3-distro
	py3-feedparser
	py3-filelock
	py3-packaging
	py3-requests
	py3-tqdm
	py3-urllib3
	py3-yaml
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
options="net" # tests require network access
subpackages="$pkgname-pyc"
source="https://github.com/dvershinin/lastversion/archive/v$pkgver/lastversion-$pkgver.tar.gz
	fix-setuptools-deprecation.patch
	"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# Running the ignored tests will exceed Github's
	# API rate limit for unauthenticated requests
	PATH="$builddir/.testenv/bin:$PATH" \
	.testenv/bin/python3 -m pytest \
		--ignore tests/test_github.py \
		--ignore tests/test_lastversion.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
12774e69378a613469cd2fb085b54d5328790992bdd8f55ba511adc8dbe6ad69ac97c2b79621f3249d536f17d2b30d9c003d79eea5d1b119c2baf677b481b824  lastversion-3.4.6.tar.gz
f91869dbb87b6d4225b7166344d1f7213573aadcb5bbecba72985e3b7a0179627f597d133ed21da79f6219306b41bcfeb588a1266570f4839368db29f073238b  fix-setuptools-deprecation.patch
"
